#include "Generate_C_std.h"
#include "Pattern_assign_var.h"

class Pattern_assign_expr_constant : public Pattern_assign_var
{
public:

	Expr* rhs_pattern()
	{
		rhs = new Wildcard<Constant> ();
		return rhs;
	}

	void generate_code (Generate_C* gen)
	{
		assert (!agn->is_ref);

		// Check whether its in the form CONST or CLASS::CONST
		String* name = new String ("");
		if (rhs->value->class_name)
		{
			name->append (*rhs->value->class_name->value);
			name->append ("::");
		}

		name->append (*rhs->value->constant_name->value);

		INST (buf, "assign_expr_constant",
				lhs->value, name);
	}

protected:
	Wildcard<Constant>* rhs;
};

CREATE(Pattern_assign_expr_constant);
